﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SiteMaster.Master"
    Inherits="System.Web.Mvc.ViewPage<List<Microhard.WarehouseInsp.Buz.Models.SupProjectModel>>" %>

<%@ Import Namespace="Microhard.Framework.MVCHelper" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    项目台帐
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="section-header">
        <div class="title">
            <img src="<%=Url.Content("~/Content/images/ico-catalog.png")%>" alt="" />
            项目台帐
        </div>
        <div class="options">
        </div>
    </div>
    <p>
    </p>
    <table class="adminContent" border="1">
        <tr>
            <td>
                <table>
                    <tr>
                        <td>
                            项目列表：
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <%= Html.Telerik().TreeView()
                                        .Name("AjaxTreeView").HtmlAttributes(new { style = "height: 700px;width: 150px;" })
                       .ClientEvents(events => events                                  
                                       .OnSelect("onSelect")
                               )
                  .BindTo(Model, (item, supProject) =>
        {
            // bind initial data - can be omitted if there is none
            item.Text = supProject.Name ;
            item.Value = supProject.ProjectID.ToString();
            item.LoadOnDemand = Model.Count() > 0;
        })%>
                        </td>
                    </tr>
                </table>
            </td>
            <td>
                <div id="tabdiv">
                </div>
            </td>
        </tr>
    </table>
    <script type="text/javascript">
        function treeView() {
            return $('#AjaxTreeView').data('tTreeView');
        }
        function onSelect(e) {
            selectedItemID = treeView().getItemValue(e.item);

            var url = ' <%=Url.Action("MainTab","PrjMonitor", new { area = "WarehouseInsp"}) %>' + '?ProjectID=' + selectedItemID;

            $.get(url, function (result) {
                $("#tabdiv").html(result);
            });
        }
    </script>
</asp:Content>
